package com.zhl.encapsulation;

public class Student {
    //需要给外界访问的用public修饰，不能用private修饰
    //不需要的用private修饰

    private double score;

    public void setscore(double score){
        if(score > 0  && score <= 100){
            this.score = score;
        }else{
            System.out.println("非法数据!");
        }
    }

    public double getscore(){
        return score;
    }

    public void PrintPass(){
        System.out.println(score >= 60? "成绩合格" : "成绩不合格");

    }


}
